<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let a = {}
        class Employee {
            constructor(name, age, sayMsg) {
                this.name = name
                this.age = age
                this.sayMsg = sayMsg
            }
            // say 方法是挂载到原型上的 ，每次生成构造函数的时候 不会再开片空间
            say() {
                return this.name + this.age + this.sayMsg
            }
        }
        a.userINFO = new Employee('刘翔', 42, "刑法")
        console.log(a.userINFO.say());
    </script>
</body>

</html>